package com.javasm.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;

/**
 * @Author：MoDebing
 * @Version：1.0
 * @Date：2022-09-04-20:12
 * @Description:
 */
@EnableResourceServer
@Configuration
public class RecourcesServerConfig extends ResourceServerConfigurerAdapter {


    @Override
    public void configure(HttpSecurity http) throws Exception {

        http.authorizeRequests()
                .anyRequest()
                .authenticated() // 所有的访问路径都需要认证
                .and()
                .requestMatchers()
                .antMatchers("/user/**"); //放行user下面的资源
    }
}
